RedBoxCastEvent
| Kind of class: | public class |
|---|---|
| Package: | com.smartfoxserver.redbox.events |
| Inherits from: | SFSEvent |
| Dispatched by: | |
| Author: | The gotoAndPlay() Team http://www.smartfoxserver.com http://www.gotoandplay.it |
| Classpath: | com.smartfoxserver.redbox.events.RedBoxCastEvent |
| File last modified: | Tuesday, 26 February 2008, 17:38:01 |
RedBoxCastEvent is the class representing all events dispatched by the RedBox's AVCastManager instance.
The RedBoxCastEvent extends the SFSEvent class, which in turn extends the flash.events.Event class.
SFSEvent also provides a public property called
The RedBoxCastEvent extends the SFSEvent class, which in turn extends the flash.events.Event class.
SFSEvent also provides a public property called
params of type Object that can contain any number of parameters.Usage:
- Please refer to the specific events for usage examples and
paramsobject content.
Summary
Event handlers
- onAVConnectionInited : String
- Dispatched when the connection to Red5 server has been established.
- onAVConnectionError : String
- Dispatched when the connection to Red5 server can't be established.
- onLiveCastPublished : String
- Dispatched when a user in the current room published his own live stream.
- onLiveCastUnpublished : String
- Dispatched when a user in the current room stops his own live stream.
Event handlers
onAVConnectionError
public static const onAVConnectionError:String = "onAVConnectionError"
(read)
Dispatched when the connection to Red5 server can't be established.
This event is dispatched when an error or special condition (like "connection closed") occurred in the flash.net.NetConnection object used internally by the AVCastManager to handle the connection to Red5.
This kind of error is always related to the Red5 server connection, so you should check if the server is running and reachable.
Also check the Red5 logs or console output for more details.
NOTE: when a connection error occurs, all the playing streams are stopped.
The
This event is dispatched when an error or special condition (like "connection closed") occurred in the flash.net.NetConnection object used internally by the AVCastManager to handle the connection to Red5.
This kind of error is always related to the Red5 server connection, so you should check if the server is running and reachable.
Also check the Red5 logs or console output for more details.
NOTE: when a connection error occurs, all the playing streams are stopped.
The
params object contains the following parameters. Parameters:
errorCode:
(String) the description of the error condition; check the "code" property of the NetStatusEvent.info object in the Actionscript 3 Language Reference.
Example:
- The following example shows how to handle a Red5 connection error.
avCastMan.addEventListener(RedBoxCastEvent.onAVConnectionError, onAVConnectionError) function onAVConnectionError(evt:RedBoxCastEvent):void { trace("A connection error occurred: " + evt.params.errorCode) }
onAVConnectionInited
public static const onAVConnectionInited:String = "onAVConnectionInited"
(read)
Dispatched when the connection to Red5 server has been established.
This event is dispatched after the AVCastManager is instantiated or when the AVCastManager.initAVConnection method is called.
The connection to Red5 must be available before any method related to a/v streaming is called.
No parameters are provided.
This event is dispatched after the AVCastManager is instantiated or when the AVCastManager.initAVConnection method is called.
The connection to Red5 must be available before any method related to a/v streaming is called.
No parameters are provided.
Example:
- The following example shows how to handle the "onAVConnectionInited" event.
var red5IpAddress:String = "127.0.0.1" var avCastMan:AVCastManager = new AVCastManager(smartFox, red5IpAddress) avCastMan.addEventListener(RedBoxCastEvent.onAVConnectionInited, onAVConnectionInited) function onAVConnectionInited(evt:RedBoxCastEvent):void { trace("Red5 connection established") }
See also:
onLiveCastPublished
public static const onLiveCastPublished:String = "onLiveCastPublished"
(read)
Dispatched when a user in the current room published his own live stream.
This event is fired only if the AVCastManager.getAvailableCasts method has already been called.
The
This event is fired only if the AVCastManager.getAvailableCasts method has already been called.
The
params object contains the following parameters. Parameters:
liveCast:
(LiveCast) the LiveCast instance representing the live stream published.
Example:
- The following example shows how to handle a live cast published event.
avCastMan.addEventListener(RedBoxCastEvent.onLiveCastPublished, onLiveCastPublished) // A user publishes his own live cast... function onLiveCastPublished(evt:RedBoxCastEvent):void { var liveCast:LiveCast = evt.params.liveCast // Subscribe live cast var stream:NetStream = avCastMan.subscribeLiveCast(liveCast.id) // Display a/v stream on stage ... }
See also:
onLiveCastUnpublished
public static const onLiveCastUnpublished:String = "onLiveCastUnpublished"
(read)
Dispatched when a user in the current room stops his own live stream.
This event is fired only if the AVCastManager.getAvailableCasts method has already been called.
The
This event is fired only if the AVCastManager.getAvailableCasts method has already been called.
The
params object contains the following parameters. Parameters:
liveCast:
(LiveCast) the LiveCast instance representing the stopped live stream.
Example:
- The following example shows how to handle a live cast stopped event.
avCastMan.addEventListener(RedBoxCastEvent.onLiveCastUnpublished, onLiveCastUnpublished) // A user stops streaming... function onLiveCastUnpublished(evt:RedBoxCastEvent):void { var liveCast:LiveCast = evt.params.liveCast // Remove Video object from stage ... }
See also: